<!-- <form class="layui-form x-center" action="" style="width:100%">
    <div class="layui-form-pane" style="margin-top: 5px;">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <select name="cname">
                        <option value="">请选择角色</option>
                        <option value="评论相关">评论相关</option>
                        <option value="评论相关">评论相关</option>
                        <option value="会员相关">会员相关</option>
                    </select>
            </div>
            <div class="layui-input-inline">
                <input type="text" name="rules" placeholder="模块/控制器/方法" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="name" placeholder="权限名称" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline" style="width:80px">
                <button class="layui-btn" lay-submit="" lay-filter="*">
                        <i class="layui-icon">&#xe608;</i>添加</button>
            </div>
        </div>
    </div>
</form> -->
<div class="layui-table" id="AdminLogDt" lay-filter="AdminLogDt"></div>
<script>
    table.render({
        elem: '#AdminLogDt',
        height: 'full-130',
        //cellMinWidth: 80,
        skin: 'row',
        even: true,
        size: 'sm',
        url: '__APP__/Admin/Log/view',
        where: { sort: 'id', order: 'desc' },
        limit: 10,
        limits: [1, 2, 3, 5, 10, 20,50,100,200,500],
        method: 'post',
        response: {
            statusName: 'status',
            statusCode: 1,
            msgName: 'msg',
            countName: 'total',
            dataName: 'rows'
        },
        done: function(res, curr, count) {
            //如果是异步请求数据方式，res即为你接口返回的信息。
            //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            //console.log(res);
            //得到当前页码
            //console.log(curr);
            //得到数据总量
            //console.log(count);
        },
        page:true,
        cols: [
            [
                { field: 'id', title: 'ID', checkbox: true, fixed: true },
                { field: 'username', width: 100, title: '名称' },
                { field: 'time', width: 180, title: '时间' },
                { field: 'node', width: 400, title: '节点' },
                {
                    field: 'type',
                    width: 250,
                    title: '类型',
                    align: 'center'
                },
                { field: 'ip', width: 200, title: 'IP' },
                { field: 'remark', width: 200, title: '备注', fixed: 'right' },
                { fixed: 'right', width: 150, align: 'center', toolbar: '#AdminLogDtBar' } //这里的toolbar值是模板元素的选择器
            ]
        ]
    });
    //监听工具条
    table.on('tool(AdminLogDt)', function(obj) {
        var data = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
        // console.log(layEvent);
        // console.log(obj);
        var tr = obj.tr; //获得当前行 tr 的DOM对象

        if (layEvent === 'detail') { //查看
            alert("查看");
            //do somehing
        } else if (layEvent === 'del') {
            layer.confirm('您是否要删除当前选中的项目？', function(index) {
                //发异步删除数据
                var ids = new Array();
                ids.push(data.id);
                $.ajax({
                    url: '{:U("Node/delete")}',
                    data: { ids: ids.join(',') },
                    dataType: 'json',
                    success: function(r) {
                        if (r.status) {
                            table.reload('AdminLogDt');
                        }
                        layer.close(index);
                        layer.msg(r.info);
                    }
                });
            });
        }
    });
</script>
<script type="text/html" id="AdminLogDtBar">
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
    <!-- 这里同样支持 laytpl 语法，如： -->
    {{# if(d.auth > 2){ }}
    <a class="layui-btn layui-btn-xs" lay-event="check">审核</a> {{# } }}
</script>